//
//  MainZenoViewRightCell.m
//  project
//
//  Created by 张振宇 on 15/10/31.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "MainZenoViewRightCell.h"
#import <UIImageView+WebCache.h>
@interface MainZenoViewRightCell()

@property (nonatomic, strong) UIImageView *icon;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UIView *imageV;

@end
@implementation MainZenoViewRightCell

- (void)awakeFromNib {
    // Initialization code
}
-(void)setConfigure:(MainZenoModel *)configure
{
    _configure = configure;
    [_icon sd_setImageWithURL:[NSURL URLWithString:configure.icon_url]];
    _nameLabel.text = configure.name;
    _descLabel.text = configure.desc;
    
    for (int i = 0; i <configure.image_urls.count; i++) {
        if (i == 0) {
            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 10, ((kWidth - 120)/3*2), ((kWidth - 120)/3*2))];
            [img sd_setImageWithURL:configure.image_urls[i]];
            [_imageV addSubview:img];
        }
        else
        {
            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake( ((kWidth - 120)/3 + 5)*2 +((kWidth - 120)/3 + 5)*(i%2), 10 + ((kWidth - 120)/3 + 5) *((i - 1)/2), (kWidth - 120)/3, (kWidth - 120)/3)];
            [img sd_setImageWithURL:configure.image_urls[i]];
            [_imageV addSubview:img];
        }
    }
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _icon = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 40, 40)];
        [self.contentView addSubview:_icon];
        
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(50, 10, kWidth -150, 20)];
        _nameLabel.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:_nameLabel];
        
        _descLabel = [[UILabel alloc]initWithFrame:CGRectMake(50, 30, kWidth - 150, 10)];
        _descLabel.font = [UIFont systemFontOfSize:12];
        [_descLabel setTextColor:[UIColor grayColor]];
        [self.contentView addSubview:_descLabel];
        
        UILabel *nextLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth - 80, 20, 80, 20)];
        [nextLabel setTextColor:[UIColor grayColor]];
        nextLabel.text = @"品牌主页>";
        [self.contentView addSubview:nextLabel];
        
        _imageV = [[UIView alloc]initWithFrame:CGRectMake(10, 50, kWidth - 20, 200)];
        [self.contentView addSubview:_imageV];
        
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
